package xyz.zhno.upload.controller;

import org.apache.commons.io.FilenameUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ResourceUtils;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import xyz.zhno.upload.service.FileService;

import java.io.File;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.UUID;

@RestController
public class FileController {

    @Autowired
    private FileService fileService;

    @PostMapping("/file/upload")
    public String upload(MultipartFile file) throws Exception {
        fileService.upload(file);
        return "success";
    }

}
